package c;
//demo2部分
public class Goods {
    private String id;
    private String name;
    private String brand;
    private int count;
    private double price;
    public Goods(String id, String name, String brand, int count, double price) {
        this.id = id;
        this.name = name;
        this.brand = brand;
        this.count = count;
        this.price = price;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    @Override
    public int hashCode() {
        int hc = 1;
        hc = 31 * hc + ((id == null) ? 0 : id.hashCode());
        hc = 31 * hc + ((name == null) ? 0 : name.hashCode());
        hc = 31 * hc + count;
        hc = 31 * hc + (int)price;
        return hc;
    }

    @Override
    public boolean equals(Object obj) {
        if(!(obj instanceof Goods))
            return false;
        Goods other = (Goods) obj;
        if(this == other)
            return true;
        if(other.id.equals(this.id) && other.name.equals(this.name) && other.brand.equals(this.brand) && other.count == this.count &&other.price == this.price)
            return true;
        else
            return false;
    }
}
